#include("/WEB-INF/admin/common/header.html")
<body class="childrenBody" id="orgAdd">
	<form class="layui-form">
		<div class="layui-form-item">
		    <label class="layui-form-label">上级部门：</label>
		    <div class="layui-input-block">
		      <select name="parentid" lay-search="">
		        <option value="" >直接选择或搜索选择</option>
		        #for(org:OrgAll)
		        	<option value="#(org.id)" #if(org.LAY_CHECKED==1) selected #end >#(org.name)</option>
		        #end
		      </select>
		    </div>
		 </div>
		 <div class="layui-form-item">
		    <label class="layui-form-label">排序：</label>
		    <div class="layui-input-block">
		      <input type="text" name="org.displayorder" lay-verify="required" placeholder="请输入内容" class="layui-input" value="#(org.displayorder ??)">
		    </div>
		  </div>
		  <div class="layui-form-item">
		    <label class="layui-form-label">部门名称：</label>
		    <div class="layui-input-block">
		      <input type="text" name="org.name" lay-verify="required" placeholder="请输入部门名称" class="layui-input" value="#(org.name)">
		    </div>
		  </div>
		   <div class="layui-form-item layui-form-text">
		    <label class="layui-form-label">描述：</label>
		    <div class="layui-input-block">
		      <textarea placeholder="请输入内容" class="layui-textarea" name="org.description">#(org.description ??)</textarea>
		    </div>
		  </div>
		  <input type="hidden" name="org.id" id="id" value="#(org.id)"/>
		  <hr class="rollHr">
	<div class="layui-form-item layui-affirm bouncedFooter">
		<a class="layui-btn bFffButton" id="peoEditcancelButton">取消</a> 
		<a class="layui-btn bFaaButton" lay-submit=""  lay-filter="orgAdd">确定</a>    	
	</div>
	</form>

<script type="text/javascript" src="#(BASE_PATH)/static/layui/layui.js"></script>
<script >
layui.use(['laydate','form','jquery','table'],function(){
    	 var form = layui.form,
		 	$ = layui.jquery,
		 	table = layui.table,
		 	laydate=layui.laydate;
    	 
    	 $("#peoEditcancelButton").click(function(){
 			var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
 			console.log(index);
 			parent.layer.close(index); //再执行关闭   
 		})
    	 //提交
    	 form.on('submit(orgAdd)', function(data){
 		  	$.post('/security/org/update',data.field,function(msg){
 				 if(msg.statusCode==200){
 					 layer.msg(msg.message, {time: 1000},function(){
 						 parent.location.reload()
 					 });  			
 				 }else{
 					
 					 layer.open({
 					        type: 1,				       
 					        id: 'message',
 					        content: '<div style="padding: 20px 100px;">'+ msg.message +'</div>',
 					        btn: '确定',
 					        btnAlign: 'c',
 					        shade: 0.4 ,
 					        yes: function(){
 					         layer.closeAll();
 					        }
 					    });
 				 }		 
 			  });
 		    return false;
 		  });
    	 
    	 
})

</script>
</body>
</html>

